package com.jsj.bs.controller;

import com.jsj.bs.service.TbEssayService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.support.SessionStatus;

import javax.servlet.http.HttpSession;

/**
 * @author King_long
 * @program: lxlproject
 * @Date 2019/12/31 20:49
 */
@Controller
public class RootController {

    private static final Logger LOGGER= LogManager.getLogger(RootController.class);

    @Autowired
    private TbEssayService tbEssayService;

    @GetMapping("{page}")
    public String page(@PathVariable("page")String page){
        return page;
    }
    //@RequestMapping(value = {"/user/quit","login-leader"})
    @RequestMapping(value = "/user/quit",method = RequestMethod.GET)
    public String quit(HttpSession session,SessionStatus status){
        System.out.println("=进入清除session=");
        //安全退出start
        //Subject subject = SecurityUtils.getSubject();
        //subject.logout();
        session.removeAttribute("account");
        //end
        status.setComplete();
        System.out.println("==清理完成==");
        return "redirect:/index.jsp";
    }

}
